<template>
	<view class="protocolRule">
		<u-navbar :autoBack="true" leftIconSize="40rpx"  :title="navBarName[type]" :placeholder="true" bgColor="#fff" :titleStyle="{ fontSize: '30rpx' , fontWeight: 'bold'}"></u-navbar>
		<rich-text
			class="content"
			:nodes="richTextData"
		></rich-text>
	</view>
</template>

<script>
	import {protocolRule} from '@/common/apis/other.js'
	export default{
		data(){
			return {
				type:0,
				navBarName:{
					1:"用户协议",
					2:"隐私政策",
					3:"平台规则",
					4:"注销重要通知",
					5:"商户入驻申请协议",
					6:"注销声明",
					7:"关于我们",
					8:"资质证照"
				},
				keys:{
					1:"sys_user_agree",
					2:"sys_userr_privacy",
					3:"platform_rule"
				},
				richTextData:""
			}
		},
		onLoad(options) {
			this.type = options.type
		},
		mounted() {
			this.getProtocolRule();
		},
		methods:{
			getProtocolRule(){
				let key = this.keys[this.type];
				protocolRule(key).then(res=>{
					if(res.data){
						this.richTextData = res.data[key];
					}
				})
			}
		}
		
	}
</script>

<style lang="scss" scoped>
	.protocolRule{
		width: 100%;
		height: 100%;
		background-color: #fff;
		float: left;
	}
	.content{
		width: 95%;
		height: auto;
		float: left;
		margin-left: 2.5%;
	}
</style>